<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>健康内容管理</title>
    <%@ include file="../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <script src="${ctx}/js/plugins/jquery.qrcode.min.js?t=${now}"></script>
    <script src="${ctx}/js/common/upLoadingFileSize.js?t=${now}"></script>
    <script src="${ctx}/js/plugins/jquery.ajaxfileupload-2.1.js?t=${now}"></script>
    <style>
        .modal-body-height > .form-group > div{
            padding-top: 7px;
        }
        .div-hidden{
            display: none;
        }
    </style>
    <script>
        var dataStatus = ${dataStatus};
        var publishStatus = ${publishStatus};
        var searchInfo = ${searchInfo};
        var contentType = ${contentType};
        var YesOrNo = ${YesOrNo};
        var contentTypes = ${contentTypes};
        var bizMap = ${bizMap};
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-table"></i>健康内容管理</h5>
                    </div>
                    <div class="ibox-content ibox-content-search">
                        <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">标题关键字：</label>
                                <div class="col-sm-3" >
                                <input id="title" name="title" class="form-control"
                                       onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                       placeholder="输入标题，专家，科室关键字" maxlength="30" value="${not empty searchInfo ? searchInfo.title : ''}"/>
                                </div>
                            <label class="col-sm-1 control-label">创建时间：</label>
                            <div class="col-sm-3">
                                <input placeholder="创建时间" class="form-control layer-date" id="gmtCreate" name="gmtCreateStr" value="${not empty searchInfo ? searchInfo.gmtCreateStr : ''}">
                            </div>
                            <div class="ibox-tools ibox-tools-search">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools()"><i class="fa fa-caret-down"></i></button>
                            </div>
                          </div>
                            <div class="search-tools">
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">发布状态：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="status" id="status" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${publishStatus}" var="item">
                                                <option value="${item.key}"
                                                    ${not empty searchInfo.status && searchInfo.status == item.key ? 'selected' : '' }
                                                >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">数据状态：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="dataStatus" id="dataStatus" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${dataStatus}" var="item">
                                                <option value="${item.key}"
                                                    ${not empty searchInfo.dataStatus && searchInfo.dataStatus == item.key ? 'selected' : '' }
                                                >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">内容类型：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="fcontentType" id="fcontentType" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${contentType}" var="item">
                                                <option value="${item.key}"
                                                    ${not empty searchInfo.fcontentType && searchInfo.fcontentType == item.key ? 'selected' : '' }
                                                >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                                <!--      --------------------------------------------------------------------------------------------------------           -->
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">关联科室：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="oneLevelDeptCode" id="oneLevelDeptCode" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${deptInfoMap}" var="item">
                                                <option value="${item.key}"
                                                    ${not empty searchInfo.oneLevelDeptCode && searchInfo.oneLevelDeptCode == item.key ? 'selected' : '' }
                                                >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">所属专家：</label>
                                    <div class="col-sm-3">
                                        <div class="input-group">
                                            <input type="text" class="hideItem" id="pDocCode" name="docCode"
                                                   value="${not empty searchInfo.docCode ? searchInfo.docCode :''}">
                                            <input type="text" id="pDocName" name="docName" class="form-control" maxlength="25"
                                                   value="${not empty searchInfo.docName ? searchInfo.docName:''}"  placeholder="输入专家名称">
                                            <div class="input-group-btn" style="width:0px!important;border-radius:0px!important">
                                                <button type="button" class="btn btn-default dropdown-toggle mySearchBtn" data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="col-sm-1 control-label">服务商：</label>
                                    <div class="col-sm-3">
                                        <div class="input-group">
                                            <input type="text" class="hideItem" id="PisvPid" name="isvPid"
                                                   value="${not empty searchInfo.isvPid ? searchInfo.isvPid : ''}">
                                            <input type="text" id="pIsvName" name="isvName" class="form-control" maxlength="25"
                                                   value="${not empty searchInfo.isvName ? searchInfo.isvName: ''}"  placeholder="输入服务商名称">
                                            <div class="input-group-btn" style="width:0px!important;border-radius:0px!important">
                                                <button type="button" class="btn btn-default dropdown-toggle mySearchBtn" data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                              <!--      -------------------------------------------------------------------------------------           -->
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">是否付费内容：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="isFree" id="isFree" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <option value="N" ${not empty searchInfo.isFree && searchInfo.isFree == 'N' ? 'selected' : '' }>是</option>
                                            <option value="Y" ${not empty searchInfo.isFree && searchInfo.isFree == 'Y' ? 'selected' : '' }>否</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">是否平台收费：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="isPlatformCharge" id="isPlatformCharge"  onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${YesOrNo}" var="item">
                                                <option value="${item.key}" ${not empty searchInfo.isPlatformCharge && searchInfo.isPlatformCharge == item.key ? 'selected' : '' }>${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">是否系列课程：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="isContentType" id="isContentType" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                                <option value="1" ${not empty searchInfo.isContentType && searchInfo.isContentType == '1' ? 'selected' : '' }>是</option>
                                                <option value="0" ${not empty searchInfo.isContentType && searchInfo.isContentType == '0' ? 'selected' : '' }>否</option>
                                        </select>
                                    </div>
                                 </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="ibox-tools col-sm-offset-2">
                            <c:if test="${userType == 'super' || not empty btnMap['addContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="add()">新增</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['editContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="edit()">编辑</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['commitContent']}">
                                <input type="button" class="btn btn-primary btn-outline" onclick="beforePublish()" value="提交发布">
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['revokeContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="unPublishContent()">撤销发布</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['delContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="dele()">删除</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['importContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doImport()">导入</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['exportContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="download()">导出</button>
                            </c:if>
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                            <c:if test="${userType == 'super' || not empty btnMap['showContent']}">
                                <button type="button" class="btn btn-primary btn-outline" onclick="showList()">预览</button>
                            </c:if>
                        </div>
                    </div>
                    <div class="ibox-content ibox-content-table">
                        <table class='table table-striped table-hover'
                                id="dataTable" data-height="400"
                                data-toggle="table"
                                data-url="${ctx}/health/pageFindContentData?t=${now}"
                                data-pagination="true"
                                data-side-pagination="server"
                                data-striped="true"
                                data-response-handler="handleServerResult"
                                data-query-params-type=""
                                data-query-params="getParams"
                                data-cache="false"
                                data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                                data-page-size="${defaultPageSize}"
                                data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="id" data-visible="false">主键id</th>
                                <th data-field="contentCode" data-formatter="time" data-align="center" data-width="250px">内容ID</th>
                                <th data-field="dataStatus" data-align="center" data-formatter="formatDataStatus" data-width="100px">数据状态</th>
                                <th data-field="status" data-align="center" data-formatter="formatStatus" data-width="100px">发布状态</th>
                                <th data-field="isvName" data-align="center" data-width="120px">服务商</th>
                                <th data-field="title" data-align="center" data-width="200px">内容标题</th>
                                <th data-field="contentType" data-align="center" data-formatter="formatContentType" data-width="120px">内容类型</th>
                                <th data-field="bizName" data-align="center"  data-width="120px">关联服务项</th>
                                <th data-field="contentType" data-align="center" data-formatter="dataType" data-width="100px">系列课程</th>
                                <th data-field="docName" data-align="center" data-width="120px">关联专家</th>
                                <th data-field="deptName" data-align="center" data-width="120px">关联科室</th>
                                <th data-field="sicknessName"  data-align="center" data-width="200px">关联疾病</th>
                                <th data-field="isFree" data-align="center" data-width="120px" data-formatter="formatFree">是否为付费内容</th>
                                <th data-field="price" data-align="center" data-width="80px">现价</th>
                                <th data-field="isPlatformCharge" data-align="center" data-width="100px" data-formatter="formatType">是否平台收费</th>
                                <c:if test="${userType == 'super' || userType == 'sysadmin'}">
                                <th data-field="readedTotal" data-align="center" data-width="80px">阅读数</th>
                                <th data-field="buyTotal" data-align="center" data-width="80px">参与数</th>
                                </c:if>
                                <th data-field="creator"  data-align="center" data-width="100px">创建人</th>
                                <th data-field="gmtCreate" data-formatter="time" data-align="center" data-width="140px">创建时间</th>
                                <th data-field="operator"  data-align="center" data-width="100px">最后操作人</th>
                                <th data-field="gmtModify" data-formatter="time" data-align="center" data-width="140px">最后操作时间</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="text-center">${companyName}</div>
            </div>
        </div>
 </div>
<div id="addContent" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 style="font-weight: normal;">选择内容类型</h4>
            </div>
            <div class="modal-body modal-body-height" >
                <div class="form-group">
                    <div class="col-sm-3 text-right"><span style="color: red;">*</span>内容类型：</div>
                    <div class="col-sm-9">
                        <%--<input type="hidden" id="hiddenId" name="id" />--%>
                        <%--<input type="hidden" id="hiddenContentCode">--%>
                        <select  class="form-control" id="pContentType" name="contentType" onchange="changeContent(this.value)" required>
                            <c:forEach items="${contentTypes}" var="item">
                                <option value="${item.code}"
                                    ${not empty searchInfo.contentType && searchInfo.contentType == item.code ? 'selected' : '' }
                                >${item.name}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-3 text-right"><span style="color: red;">*</span>服务项关联：</div>
                    <div class="col-sm-9">
                        <select  class="form-control" id="bizCode" name="bizCode" required>
                            <c:forEach items="${bizMap}" var="item">
                                <option value="${item.key}"
                                    ${not empty searchInfo.bizCode && searchInfo.bizCode == item.key ? 'selected' : '' }
                                >${item.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>

                <div class="form-group" id="typeDiv">
                    <div class="col-sm-3 text-right"><span style="color: red;">*</span>类别选择：</div>
                    <div class="col-sm-9">
                        <label><input name="lesson_common" type="radio" value="lesson_image" />图文 </label>&nbsp;&nbsp;
                        <label><input name="lesson_common" type="radio" value="lesson_audio" />音频</label>&nbsp;&nbsp;
                        <label><input name="lesson_common" type="radio" value="lesson_video" />视频</label>
                    </div>
                </div>
              </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doSaveType()">保存</button>
                <button class="btn btn-white" onclick="$('#addContent').modal('hide')" >取消</button>
            </div>
        </div>
    </div>
</div>


<div id="unPublishLessonWin" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header text-center">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 >撤销发布</h4>
            </div>
            <div class="modal-body modal-body-height" >
                <div class="row">
                    <div class="col-sm-1 text-right error"></div>
                    <div class="col-sm-11 text-left"><span style="color: red">*</span>请输入撤销发布原因</div>
                </div>
                <c:forEach items="${appOperReason}" var="item">
                    <div class="row">
                        <div class="col-sm-1 text-right"></div>
                        <div class="col-sm-11 text-left"><input type="checkbox" name="error_text" value="${item.dictName}">${item.dictName}</div>
                    </div>
                </c:forEach>
                <div class="row">
                    <div class="col-sm-1 text-right"></div>
                    <div class="col-sm-11 text-left">
                        <textarea id="error_textarea" name="error_textarea" cols="30" rows="10" class="form-control"></textarea>
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doUnPublishContent()">撤销发布</button>
                <button class="btn btn-white" onclick="$('#unPublishLessonWin').modal('hide')">取消</button>
            </div>
        </div>
    </div>
</div>


<div id="delContentWin" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header text-center">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 >删除</h4>
            </div>
            <div class="modal-body modal-body-height" >
                <div class="row">
                    <div class="col-sm-1 text-right error"></div>
                    <div class="col-sm-11 text-left"><span style="color: red">*</span>请输入删除原因</div>
                </div>
                <c:forEach items="${appOperReason}" var="item">
                    <div class="row">
                        <div class="col-sm-1 text-right"></div>
                        <div class="col-sm-11 text-left"><input type="checkbox" name="del_text" value="${item.dictName}">${item.dictName}</div>
                    </div>
                </c:forEach>
                <div class="row">
                    <div class="col-sm-1 text-right"></div>
                    <div class="col-sm-11 text-left">
                        <textarea id="del_textarea" name="del_textarea" cols="30" rows="10" class="form-control"></textarea>
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="dodelContent()">删除</button>
                <button class="btn btn-white" onclick="$('#delContentWin').modal('hide')">取消</button>
            </div>
        </div>
    </div>
</div>

<div id="scanQrCodePage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header text-center">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4>扫码预览</h4>
            </div>
            <div class="modal-body modal-body-height">
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <div id="qrcode" style="height: 250px; width: 250px;padding-left: 150px"></div>
                    </div>
                    <div class="col-sm-12 text-center">打开支付宝钱包扫一扫即可查看效果</div>
                    <div class="col-sm-12 text-center">二维码有效期为<span id="_validNum"></span>秒</div>
                </div>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-white" onclick="$('#scanQrCodePage').modal('hide')">关闭</button>
            </div>
        </div>
    </div>
</div>

<div id="importPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <h4><span id="_importTitle">导入付费问答信息</span></h4>
            </div>
            <div class="modal-body modal-body-height modal-body-height-new " id="_ImportExcelDiv">
                <div class="row">
                    <form class="form-horizontal m-t" id="_dataForm">
                        <div class="form-group">
                            <div class="col-sm-12">
                                <label class="ui-upload disable-color-style margin-style" id="_chooseFile">浏览<input type="file" id="excelData" name="excelData" style="display: none;" onchange="fileChangeEvent(this)"/></label>
                                <button class="btn btn-white" onclick="downTemplate()">下载问答模板</button>
                                <span>只支持导入Excel文件，文件大小不超过1MB</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12">
                                <label class="control-label" id="_fileName"></label>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="row div-hidden" id="_errorTipDiv">
                    <div class="col-sm-12" style="padding: 0px;">
                        <label class="control-label" id="_importTip"></label>
                        <div class="ibox float-e-margins">
                            <div class="ibox-content none-border"  style="padding:0px 0px 20px 0px;">
                                <table class='table table-striped table-hover'
                                       id="errorTable"
                                       data-toggle="table"
                                       data-striped="true"
                                       data-response-handler="handleServerResult"
                                       data-page-size="${defaultPageSize}"
                                       data-page-list="${pageList}">
                                    <thead>
                                    <tr>
                                        <th data-field="index" data-align="center" data-width="90px">行数</th>
                                        <th data-field="reason" data-align="left">错误提示</th>
                                    </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="text-align: right;">
                <button type="button" class="btn btn-primary" onclick="doImportQaExcel()">导入</button>
                <button class="btn btn-white" onclick="$('#importPage').modal('hide')">取消</button>
            </div>
        </div>
    </div>
</div>

<script src="${ctx}/js/health/healthContent.js?t=${now}"></script>

</body>
</html>

